<template>
    <div>

        <el-form class="form-detail" :inline="true">

            <el-row :gutter="20" style="width:100%">

                <el-col :span="8">
                    <el-form-item label="跟进职员：">
                        {{ userInfo.realName }}
                    </el-form-item>
                </el-col>

                <el-col :span="8" v-if="datas.dealTime">
                    <el-form-item label="确认时间：">
                        {{ dateFormat('yyyy-mm-dd HH:MM',datas.dealTime) }}
                    </el-form-item>
                </el-col>

            </el-row>

        </el-form>

        <template v-if="datas.allocationAgentDetails && datas.allocationAgentDetails.length">
            <el-table header-cell-class-name="table-header" :data="datas.allocationAgentDetails" border v-if="datas.taskType == 1 || datas.taskType == 2">
                <el-table-column type="index" label="序号" width="55"/>
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="left"
                        header-align="center"
                        label="代理名称"
                        prop="agentName"
                />
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="left"
                        header-align="center"
                        label="所在地区"
                >
                    <template #default="{row}">
                        <span v-if="row.agentType == 'agent'">{{ row.provinceName }}/{{ row.cityName }}/{{ row.areaName }}</span>
                        <span v-else>{{ row.address }}</span>
                    </template>
                </el-table-column>
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="center"
                        header-align="center"
                        label="代理商状态"
                >
                    <template #default="{row}">
                        <!--        <span v-if="row.tradeStatus == 1">正式代理商</span>-->
                        <!--        <span v-else>准代理商</span>-->
                        <span v-if="row.agentType == 'agent'">{{ getLabel('agent_status', row?.agentStatus) }}</span>
                        <span v-else>{{ getLabel('agent_status_person', row?.agentStatus) }}</span>
                    </template>
                </el-table-column>
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="center"
                        header-align="center"
                        label="开发跟进期限"
                >
                    <template #default="{row}">
                        {{ dateFormat('yyyy-mm-dd', row.dealTime) }}
                    </template>
                </el-table-column>

            </el-table>

            <el-table v-else-if="datas.taskType == 4" :data="datas.allocationAgentDetails" header-cell-class-name="table-header" border size="medium">
                <el-table-column type="index" label="序号" width="55"/>
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="left"
                        header-align="center"
                        label="商销客户名称"
                        prop="sellerName"
                />
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="left"
                        header-align="center"
                        label="所在地区"
                >
                    <template #default="{row}">
                        <span>{{ row.selProvinceName }}/{{ row.selCityName }}/{{ row.selAreaName }}</span>
                    </template>
                </el-table-column>
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="center"
                        header-align="center"
                        label="客户状态"
                >
                    <template #default="{row}">
                        {{ getLabel('seller_status', row.sellerStatus) }}
                    </template>
                </el-table-column>
                <el-table-column
                        :show-overflow-tooltip="true"
                        align="center"
                        header-align="center"
                        label="开发跟进期限"
                >
                    <template #default="{row}">
                        {{ dateFormat('yyyy-mm-dd', row.dealTime) }}
                    </template>
                </el-table-column>
            </el-table>
        </template>

        <template v-else>
            <span class="gray-text" v-if="datas.taskType == 1 || datas.taskType == 2">未指向意向代理信息</span>
            <span class="gray-text" v-else-if="datas.taskType == 4">未分配意向商销客户</span>
        </template>

    </div>
</template>

<script>
    import {crmStore} from "../../../../../../store";
    import { defineComponent } from 'vue'
    export default defineComponent({
        name: "allocationView",
        props:{
            datas:{
                type:Object,
                default:{}
            }
        },
        setup(){
            const userInfo = crmStore.getters['user/userInfo']

            return{
                userInfo,
            }
        }
    })
</script>

<style lang="scss" scoped>
    @import "@/style/basics.scss";
    .gray-text{
        color:$font-color-info
    }
</style>
